<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        // 使用原生SQL修改timestamp字段
        DB::statement('ALTER TABLE wechat_service_account_users MODIFY COLUMN access_token_expires_at TIMESTAMP NULL');
        DB::statement('ALTER TABLE wechat_service_account_users MODIFY COLUMN created_at TIMESTAMP NULL');
        DB::statement('ALTER TABLE wechat_service_account_users MODIFY COLUMN updated_at TIMESTAMP NULL');
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        // 回滚时恢复原始类型
        DB::statement('ALTER TABLE wechat_service_account_users MODIFY COLUMN access_token_expires_at DATETIME NULL');
        DB::statement('ALTER TABLE wechat_service_account_users MODIFY COLUMN created_at DATETIME NULL');
        DB::statement('ALTER TABLE wechat_service_account_users MODIFY COLUMN updated_at DATETIME NULL');
    }
};